package com.example.springbootwebsocketmonikehuduan;

import com.alibaba.fastjson.JSON;
import com.example.springbootwebsocketmonikehuduan.entity.Menjing;
import redis.clients.jedis.Jedis;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: springboot-websocket-monikehuduan
 * @description: 测试
 * @author: XianJin.Lu
 * @create: 2021-09-05 19:45
 **/
public class Test01 {
    public static void main(String[] args) {

        //获取所有门禁设备请求体
        String   s4=   "{'head':{'cmdType':1,'cmdSn':'0001'},'data':{'devId':0}}";
        //Menjing{cmdSn='0001', result=0, resultDesc='succ', resultData=[ResultData{devAddr='10.0.9.101', devPort='6000', devId='1', devType='1', devPos='1', doorNum=1, areaName='区域1'}

        //获取指定devId门状态 的请求体
        String  s2=   "{'head':{'cmdType':2,'cmdSn':'0002'},'data':{'devId':3,'operType':0,'doorIndex':0}}";

        //门禁状态控制n   4 关门  0 开门
        String  s3=   "{'head':{'cmdType':4,'cmdSn':'0002'},'data':{'devId':3,'open':0,'doorIndex':0}}";

        WebsocketClient333 websocketClient333 = new WebsocketClient333(s4);

        websocketClient333.find2();


        //响应
     //   Menjing menjing = websocketClient333.find2();


   //     if(menjing==null){
  //         System.out.println("连接超时,请联系管理员");
   //    }else{
   //        System.out.println(menjing);

    //        String s = JSON.toJSONString(menjing);

          /*  Jedis jedis = new Jedis("127.0.0.1", 6379);

            jedis.hset("KEY_HASH_POW_MJ_SIGNAL", "key4", s);
            System.out.println(jedis.hget("KEY_HASH_POW_MJ_SIGNAL", "key4"));

            System.out.println(jedis.ping());*/


           //获取到数据后,可在此关闭连接
          websocketClient333.client.close();



    }



}
